#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 2e5 + 10;
int a[N], n, L, R;

ll cal(int x) {
    int l = 1, r = n;
    ll ans = 0;
    while (l < r) {
        while (l<r && a[l] + a[r]>x) {
            r--;
        }
        ans += r - l;
        l++;
    }
    return ans;
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> L >> R;
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + n + 1);
    cout << cal(R) - cal(L - 1) << '\n';
    return 0;
}